<!DOCTYPE html>
<html>
<head>
<script src='../resources/runner.js'></script>
</head>
<body>
<script>

function runTest() {
  navigator.serviceWorker.addEventListener('message', (msg) => {
    PerfTestRunner.recordResultFromWorker(msg.data);
  });

  const script =
      '/service_worker/resources/cache-open-add-delete-1M-service-worker.js';
  const scope = '/service_worker/resources/';
  navigator.serviceWorker.register(script, { scope: scope }).catch((error) => {
    PerfTestRunner.logFatalError(
        'Failed to register service worker script:' + script);
  });
  return;
}

PerfTestRunner.startMeasureValuesInWorker({
  description: 'Measure performance of open, add and delete operations of' +
      ' cache with 1M sized file',
  unit: 'runs/s',
  run: runTest,
});
</script>
</body>
</html>
